package com.rushb.rushbproduct.result;


import com.rushb.rushbproduct.constont.ErrorCode;

import java.io.Serializable;

public class Result<T> implements Serializable {

    private static final long serialVersionUID = 1L;

    public static final String SUCCESS_CODE="0000";
    public static final String SUCCESS_MSG="success";

    private String code=SUCCESS_CODE;
    private String errorMsg=SUCCESS_MSG;
    private String tips;
    private T data;

    @Override
    public String toString() {
        return "Result{" +
                ", code='" + code + '\'' +
                ", errorMsg='" + errorMsg + '\'' +
                ", tips='" + tips + '\'' +
                ", data=" + (data == null ? null : data.hashCode()) +
                '}';
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getErrorMsg() {
        return errorMsg;
    }

    public void setErrorMsg(String errorMsg) {
        this.errorMsg = errorMsg;
    }

    public String getTips() {
        return tips;
    }

    public void setTips(String tips) {
        this.tips = tips;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    public Result(T data, ErrorCode errorCode){
        this.code=errorCode.getErrorCode();
        this.errorMsg=errorCode.getErrorMsg();
        this.tips=errorCode.getTips();
        this.data=data;
    }

    public Result(T data){
        this.data=data;
    }

    public Result(ErrorCode errorCode){
        this.code=errorCode.getErrorCode();
        this.errorMsg=errorCode.getErrorMsg();
        this.tips=errorCode.getTips();
    }

    public Result(String message, ErrorCode errorCode){
        this.code=errorCode.getErrorCode();
        this.errorMsg=message;
        this.tips=errorCode.getTips();
    }





    public Result(){

    }
}
